package com.xiaodou.mjf.infrastructure.payeco;

import com.xiaodou.mjf.infrastructure.common.context.SpringContextHolder;
import com.xiaodou.mjf.infrastructure.common.utils.PropertiesLoader;
import org.springframework.core.env.Environment;

import java.util.Properties;

/**
 * Created by Rocky on 15/4/9.
 */
public class Payeco {

    private static Properties props = new PropertiesLoader("classpath:properties/payment/payeco.development.properties").getProperties();

    static {

        Environment env = SpringContextHolder.getApplicationContext().getEnvironment();
        if(env != null) {
            if (env.acceptsProfiles("development")) {
                System.out.println("Development");
            }

            if (env.acceptsProfiles("production")) {
                props = new PropertiesLoader("classpath:properties/payment/payeco.production.properties").getProperties();
            }
        }

    }


    public static class EC{


        public static String merchant_id = props.getProperty("b2c.merchant_id");
        public static String private_key = props.getProperty("b2c.merchant_private_key");
        public static String public_key = props.getProperty("b2c.payeco_public_key");
        public static String payeco_url = props.getProperty("b2c.payeco_url");

    }

    public static class IF{

        public static String merchant_id = props.getProperty("if.merchant_id");
        public static String private_key = props.getProperty("if.merchant_private_key");
        public static String collection_public_key = props.getProperty("if.collection.payeco_public_key");
        public static String payment_public_key = props.getProperty("if.payment.payeco_public_key");
        public static String collection_url = props.getProperty("if.collection.payeco_url");
        public static String payment_url = props.getProperty("if.payment.payeco_url");
        public static String payeco_no_key = props.getProperty("if.payeco_no_key");
        public static String user_name = props.getProperty("if.user_name");


    }




}
